import React, { useEffect, useState } from 'react'
import { Table, Tag, Button, Modal } from 'antd'
import { DeleteOutlined, } from '@ant-design/icons';
import axios from 'axios'
export default function NewsPublish(props) {

    const columns = [
        {
            title: '新闻标题',
            dataIndex: 'title',
            render: (title, item) => <a href={`#/news-manage/preview/${item.id}`}>{title}</a>
        },
        {
            title: '作者',
            dataIndex: 'author',
            key: 'author',
        },
        {
            title: '新闻分类',
            dataIndex: 'category',
            key: 'category',
            render: (category) => <Tag color='orange'>{category.title}</Tag>
        },
        {
            title: '操作',
            render: (item) => {
                return <div>
                    {props.button(item.id)}
                </div >
            }
        },
    ];
    return (
        <div>
            <Table dataSource={props.dataSource} columns={columns} pagination={{
                pageSize: 10
            }}
                rowKey={(item) => item.id}
            />
        </div>
    )


}

